import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import {bizBasicInfoAllList} from "@/views/biz/BizOutbound.api";

export const columns: BasicColumn[] = [
    {
    title: '产品名称',
    dataIndex: 'productName'
   },
   {
    title: '入库单号',
    dataIndex: 'warehousingNo'
   },
   {
    title: '客户',
    dataIndex: 'customer'
   },
   {
    title: '部门',
    dataIndex: 'department'
   },
   {
    title: '订单号',
    dataIndex: 'orderNo'
   },
   {
    title: '交货日期',
    dataIndex: 'deliveryDate'
   },
];

export const searchFormSchema: FormSchema[] = [
  {
    label: '基础资料',
    field: 'baseicId',
    component: 'ApiSelect',
    componentProps: {
      // more details see /src/components/Form/src/components/ApiSelect.vue
      api: bizBasicInfoAllList,
      // resultField: 'result',
      // use name as label
      labelField: 'productName',
      // use id as value
      valueField: 'id',
      // not request untill to select
      // immediate: false,
      onChange: (e) => {
        console.log('selected:', e);
      },
      // atfer request callback
      onOptionsChange: (options) => {
        console.log('get options', options.length, options);
      },
    },


  },
 {
    label: '入库单号',
    field: 'warehousingNo',
    component: 'Input'
  },
];

export const formSchema: FormSchema[] = [
  // TODO 主键隐藏字段，目前写死为ID
  {label: '', field: 'id', component: 'Input', show: false},
  {
    label: '基础资料',
    field: 'baseicId',
    component: 'ApiSelect',
    required: true,
    componentProps: {
      // more details see /src/components/Form/src/components/ApiSelect.vue
      api: bizBasicInfoAllList,
      // resultField: 'result',
      // use name as label
      labelField: 'productName',
      // use id as value
      valueField: 'id',
      // not request untill to select
      // immediate: false,
      onChange: (e) => {
        console.log('selected:', e);
      },
      // atfer request callback
      onOptionsChange: (options) => {
        console.log('get options', options.length, options);
      },
    },


  },
  {
    label: '入库单号',
    field: 'warehousingNo',
    component: 'Input',
  },
  {
    label: '数量',
    field: 'qty',
    component: 'InputNumber',
  },
  {
    label: '客户',
    field: 'customer',
    component: 'Input',
  },
  {
    label: '部门',
    field: 'department',
    component: 'Input',
  },
  {
    label: '订单号',
    field: 'orderNo',
    component: 'Input',
  },
  {
    label: '交货日期',
    field: 'deliveryDate',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss',
    },
  },
];
